home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / wwbbs31_source.lha / WWBBS / Library / main.c < prev    next >
C/C++ Source or Header  |  1995-01-03  |  1KB  |  49 lines

  1. #include "wwbbs.h"
  2. #include "config.h"
  3. #include "status.h"
  4. #include "users.h"
  5. #include "messages.h"
  6. #include "files.h"
  7.  
  8. int __UserLibInit(void)
  9.     {
  10.         SysBase=(struct ExecBase *) 4;
  11.         DOSBase=(struct DosLibrary *) OpenLibrary("dos.library",0);
  12.         UtilityBase=OpenLibrary("utility.library",0);
  13.  
  14.         UpdatePort=NULL;
  15.         InitSemaphore(&UpdateSemaphore);
  16.  
  17.         NewList(&ConfigList);
  18.         InitSemaphore(&ConfigSemaphore);
  19.         NewList(&StatusList);
  20.         InitSemaphore(&StatusSemaphore);
  21.         NewList(&UserList);
  22.         InitSemaphore(&UserSemaphore);
  23.         NewList(&MessageGroupList);
  24.         InitSemaphore(&MessageGroupSemaphore);
  25.         NewList(&FileGroupList);
  26.         InitSemaphore(&FileGroupSemaphore);
  27.  
  28.         LoadConfig(ConfigFile);
  29.         LoadUserIndex(UserIndexFile);
  30.  
  31.         return(0);
  32.     }
  33.  
  34. void __UserLibCleanup(void)
  35.     {
  36.         ObtainSemaphore(&FileGroupSemaphore);
  37.         FlushFileGroups();
  38.         ReleaseSemaphore(&FileGroupSemaphore);
  39.         ObtainSemaphore(&MessageGroupSemaphore);
  40.         FlushMessageGroups();
  41.         ReleaseSemaphore(&MessageGroupSemaphore);
  42.         UnLoadUserIndex();
  43.         UnLoadStatus();
  44.         UnLoadConfig();
  45.  
  46.         if(UtilityBase) CloseLibrary(UtilityBase);
  47.         if(DOSBase) CloseLibrary((struct Library *) DOSBase);
  48.     }
  49.